﻿using MySystemSetup.BusinessDomain;
using MySystemSetup.ISheepYard;
using MySystemSetup.ISheepYardSer.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TodoApp.Dto;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace MySystemSetup.SheepYardSer
{
    public class SheepYardAppService: ApplicationService, ISheepYardAppService
    {


        private readonly IRepository<SheepYard, int> _sheepYardRepository;

        public SheepYardAppService(IRepository<SheepYard, int> sheepYardRepository)
        {
            _sheepYardRepository = sheepYardRepository;
        }





        /// <summary>
        /// 添加单位信息
        /// </summary>
        /// <param name="add">要添加的实体</param>
        /// <returns>统一返回个格式</returns>
        public async Task<SzrApiResult<SheepYardAddDto>> AddSheepYardAsync(SheepYardAddDto add)
        {






            await _sheepYardRepository.InsertAsync(ObjectMapper.Map<SheepYardAddDto, SheepYard>(add));




            return new SzrApiResult<SheepYardAddDto>
            {

                code = 200,
                msg = "添加成功",
            };



        } 




    }
}
